<%--
  Created by IntelliJ IDEA.
  User: hklyq
  Date: 2020-06-05
  Time: 17:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>

<script type="text/javascript">
    // 设置参数
    function setParameter() {
        //参数设置xml
        var paramSet = "<?xml version=\"1.0\" encoding=\"gbk\"?>\r\n<business id=\"20001\" comment=\"参数设置\">\r\n<body yylxdm=\"1\">\r\n<servletip>1mk7203917.imwork.net</servletip>\r\n<servletport>10387</servletport>\r\n<keypwd>88888888</keypwd>\r\n</body>\r\n</business>";
        alert(paramSet);
        try {
            ret = sk.Operate(paramSet);
            alert(ret);
            var cd = $(ret).find("returncode").text();
            if (0 == cd) {
                alert("验证成功")
            } else {
                alert("验证失败了呦")
            }
        } catch (e) {
            //alert(e.message + ",errno:" + e.number);
            alert("加载组件失败")
        }
    }

    // 税控钥匙信息查询
    function keyQuery(queryXml) {
        try {
            ret = sk.Operate(queryXml);
            var cd = $(ret).find("returncode").text();
            if (0 == cd) {
                $.ligerDialog.SQalert({content: "税控钥匙信息校验成功", SQ_type: "success"});
                return true;
            } else {
                $.ligerDialog.SQalert({content: "税控钥匙信息校验失败", SQ_type: "error"});
                return false;
            }
        } catch (e) {
            //alert(e.message + ",errno:" + e.number);
            $.ligerDialog.SQalert({content: "税控钥匙信息校验失败", SQ_type: "error"});
            return false;
        }
    }

    // 发票打印
    function printInvoiceByActiveX(paramSet, pageSet, printSet) {
        try {
            //alert(paramSet)
            ret = sk.Operate(paramSet)
            //alert(ret)

            var cd = $(ret).find("returncode").text();
            if (0 == cd) {
                //alert(pageSet)
                ret = sk.Operate(pageSet);
                //alert(ret);
                var cd = $(ret).find("returncode").text();
                if (0 == cd) {
                    //alert(printSet)
                    ret = sk.Operate(printSet);
                    var msg = $(ret).find("returnmsg").text();
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        } catch (e) {
            //alert(e.message + ",errno:" + e.number);
            return false;
        }
    }


</script>
